package org.example.leetcode.codeExecutor.api;

import org.example.leetcode.common.domain.CodeDO;
import org.example.leetcode.common.domain.CodeResult;
import org.example.leetcode.common.domain.FileDto;
import org.example.leetcode.common.pojo.GlobalResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.UnsupportedEncodingException;
import java.util.List;

@FeignClient(value = "code-executor",name = "code-executor",path = "code-executor")
public interface CodeExecutorService {
    @PostMapping("/execute")
    GlobalResponse<CodeResult> execute(@RequestBody CodeDO codeDO);
    @PostMapping(value = "/uploadFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    GlobalResponse<String> uploadFileToMinio(@RequestBody MultipartFile file,@RequestParam("objectName") String objectName);
    @GetMapping("/downloadFile")
    public GlobalResponse downloadFile(@RequestParam("bucket")String bucket,@RequestParam("objectName")String objectName);
    @PostMapping("/removeFile")
    public GlobalResponse<Boolean> removeFile(@RequestBody List<String> objectName);
}
